<?php
$connectstatus = mysql_connect("localhost", "root", "");
if (!$connectstatus){
	die('Couldn\'t connect: ' . mysql_error ());
	}
$tags = $_POST;
$flag = 0;
foreach ($tags as $value){
	$value = explode("|", $value);
	//text|text|text|int|int|text|text|text
	$sql_attempt="INSERT INTO `captsone-tagit`.`test_table` (`Type`, `Title`, `Description`, `Latitude`, `Longitude`, `Date`, `Attributes`) VALUES ('$value[0]','$value[1]','$value[2]','$value[3]','$value[4]', '$value[5]', '$value[6]')";
	if(!mysql_query($sql_attempt, $connectstatus)){
		$flag = 1;
		die('Error: '. mysql_error());
	}
}
if($flag !== 1){
	echo "Success";
}

mysql_close($connectstatus);
//var_dump($tags);
?>


